package com.suda.sudaexamsystem.pojo;

import com.suda.sudaexamsystem.dto.UserDto;

import java.util.ArrayList;
import java.util.List;

/**
 * 用户信息表
 */
public class User {
    private int id;
    private String name;
    // 登录昵称
    private String loginName;
    private String password;
    private char sex;
    // 所属班级
    private List<Clazz> clazzList = new ArrayList<>();
    // 用户角色
    private Role role;

    public UserDto toDto() {
        return new UserDto(id, name, loginName, sex == '1' ? '男' : '女');
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public char getSex() {
        return sex;
    }

    public void setSex(char sex) {
        this.sex = sex;
    }

    public List<Clazz> getClazzList() {
        return clazzList;
    }

    public void setClazzList(List<Clazz> clazzList) {
        this.clazzList = clazzList;
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", loginName='" + loginName + '\'' +
                ", password='" + password + '\'' +
                ", sex=" + sex +
                ", clazzList=" + clazzList +
                ", role=" + role +
                '}';
    }
}
